import React, { Fragment, useEffect } from 'react'
import { NavigationStackScreenComponent } from 'react-navigation-stack'
import { View, Text, Image, Alert, Platform, BackHandler } from 'react-native'
import { InfoLayout, RadiusButton } from 'components'
import { commonStyle, translateSize } from 'styles'
import { settingStyle } from './styles'
import assets from './assets'
import { TouchableOpacity } from 'react-native-gesture-handler'
import { navigate } from 'services/navigation';
import { getAuthorization, loginOut } from 'services/authorization';
import { PosModule } from 'native-modules';

const SystemSettingScreen: NavigationStackScreenComponent = props => {
	const onBackAndroid = () => {
		navigate("SignIn")
		return true;

	}

	useEffect(() => {
		if (Platform.OS === 'android') {
			BackHandler.addEventListener('hardwareBackPress', onBackAndroid);

		}
		return () => {
			if (Platform.OS === 'android') {
				BackHandler.removeEventListener('hardwareBackPress', onBackAndroid);
			}
		}
	}, [])
	return (
		<View style={[commonStyle.containerColumn, settingStyle.container]}>
			<RadiusButton
				onPress={() => {
					PosModule.settings(1)
				}}>
				<InfoLayout
					title="系统设置:"
					content={' '}
					contentIcon={assets.images.icon_arrow_right}
				// onContentPress={() => {
				// 	PosModule.settings(1)
				// }}
				/></RadiusButton>
		</View >
	)
}

SystemSettingScreen.navigationOptions = props => {
	return {
		title: '更多设置',
		headerLeft: (
			<RadiusButton
				style={{ paddingHorizontal: translateSize(24) }}
				onPress={() => {
					navigate("SignIn")
				}}>
				<Image source={assets.images.icon_arrow_left} style={{ width: translateSize(40) }} />
			</RadiusButton>
		),
	}
}

export default SystemSettingScreen
